﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DLL.impl
{
    public class DBSQLServerHelper : IDBHelper
    {
        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        private string connectionString;

        public DBSQLServerHelper(string connectionString)
        {
            this.connectionString = connectionString;
        }

        public DataTable findSendDataTable(string sql)
        {
            DataSet ds = new DataSet();
            //创建连接对象
            using (SqlConnection connection = new SqlConnection(connectionString)) {
                SqlDataAdapter da = new SqlDataAdapter(sql, connection);
                da.Fill(ds);
            }
            return ds.Tables[0];
        }
    }
}
